﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NavKet.Models;

namespace NavKet.Controllers
{
    public class DepartmentController : Controller
    {
      
        MallEntities1 navKetEntity = new MallEntities1();
        //
        // GET: /Department/

        public ActionResult Index(int id)
        {
            VW_DepartmentDetails  VWdepartment = navKetEntity.SelectVwDepartmentDetailsByDepartmentId(id).SingleOrDefault();
            Department department = navKetEntity.SelectDepartment(id).SingleOrDefault();
       
           List<Item> itemList = department.Items.ToList();
           ViewBag.MallName = VWdepartment.MallName;
           ViewBag.MallId = VWdepartment.MallId;
           ViewBag.ShopName = VWdepartment.ShopName;
           ViewBag.ShopId = VWdepartment.shopId;
           ViewBag.CategoryName = VWdepartment.CategoryName;
           ViewBag.CategoryId = VWdepartment.CategoryId;
            ViewBag.Item = itemList;
            return View(VWdepartment);
        }

    }
}
